<div class="clearfix"></div>
<div class="panel">View Block/Sections</div>
<?=$system_message;?>
<table class="table table-bordered table-striped">
	<thead>
		<tr>
			<td style="text-align:center;">Block Name</td>
			<td style="text-align:center;">Block Description</td>
			<td style="text-align:center;">Actions</td>
		</tr>
	</thead>
	<?if($block):?>
		<?foreach($block as $bk => $bv):?>
				<tr class="success">
					<td colspan="3" style="text-align:left;"><span class="label label-inverse">Level:</span> <strong><?=$bk;?></strong></td>
				</tr>
			<?foreach($bv as $bbk => $bbv):
				$ids = $this->hs->encrypt(intval($bbv['level_id']),intval($bbv['bid']));
			?>
				<tbody>
						<tr class="info">
							<td><div style="padding-left:25px;"><span class="label label-success">Block Section:</span><strong><?=$bbv['bname'];?></strong></div></td>
							<td><?=$bbv['bdesc'];?></td>
							<td>
								<div class="btn-group">
									<a href="<?=site_url('room_section_subject/add_section_to_block/'.$ids);?>" class="confirm btn btn-primary btn-mini" title="Do you want to leave this page and add a new Section to this block?">Add Section to Block</a>			
									<a href="<?=site_url('room_section_subject/edit_block/'.$ids);?>" class="confirm btn btn-success btn-mini" title="Do you want to edit block?">Edit Block</a>			
									<a href="<?=site_url('room_section_subject/delete_block/'.$ids);?>" class="confirm btn btn-danger btn-mini" title="Do you want to delete block?">Delete Block</a>					
								</div>
	
							</td>
						</tr>
					<?if($bbv['sections']):?>
						
						<?foreach($bbv['sections'] as $seck => $secv):
							$auth = $this->authlink->hash_make($secv->section_id);
						?>
							<tr>
								<td colspan="2">
									<div style="padding-left:36px;">
										<span class="label label-info">Section:</span>&nbsp;<?=$secv->section_name;?>
									</div>
								</td>
								<td>
									<a href="<?=site_url('room_section_subject/remove_section_from_block/'.$secv->section_id.'/'.$auth);?>" class="confirm btn btn-mini btn-info" title="Do you want to delete Section From Block?">Remove Section From Block</a>
								</td>
							</tr>
						<?endforeach;?>
					<?else:?>
						<tr class="error">
							<td colspan="2" style="text-align:center;">No Section Assigned For This Block</td>
						</tr>
					<?endif;?>
				</tbody>
			<?endforeach;?>
		<?endforeach;?>
	<?else:?>
	<?endif;?>
</table>